----------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Users/paulmusgrave/Dropbox/0001 Academic Projects/Ongoing/0148 The Cyber/P
> osted/FPA Version/Work/Logs/Figure3Log.log
  log type:  text
 opened on:  25 Aug 2021, 10:37:34

. 
. cd "$path/Data/"
/Users/paulmusgrave/Dropbox/0001 Academic Projects/Ongoing/0148 The Cyber/Posted/FPA Ver
> sion/Work/Data

. use "CCESUsable.dta"

. 
. * labelling and arranging variables
. 
. lab var cueCIA "CIA Treatment"

. lab var cueAgree "Agreement Treatment"

. 
. lab var white "White"

. lab var college "College"

. lab var female "Female"

. lab var threatiran "Perception of Iranian Threat"

. lab var dem7 "Democrat"

. lab var gop7 "Republican"

. lab var ind7 "Independent"

. lab var age "Age in Years"

. 
. gen interactAgreeCIA = cueAgree * cueCIA
(126 missing values generated)

. lab var interactAgreeCIA "Agreement x CIA"

. 
. 
. gen cueIndependent = .
(1,000 missing values generated)

. replace cueIndependent =1 if cueCIA == 0
(421 real changes made)

. replace cueIndependent =0 if cueCIA == 1
(453 real changes made)

. 
. lab def cueIndependentlab 0 "CIA Endorsement" 1 "Independent Endorsement"

. lab val cueIndependent cueIndependentlab

. 
. lab def cueAgreelab 0 "Divided" 1 "Support"

. lab val cueAgree cueAgreelab

. 
. 
. *********************
. * Generating figures
. *********************
. 
. /*
> This section conducts a multinomial logistic regression for all respondents
> pooled and then for Democrats, Independents, and Republicans (defined by the
> 7-point scale, with lean-D and lean-R included as Dems and Rs respectively). 
> Each regression is followed up by a margins plot producing predicted values
> for each treatment condition.
> */
. 
. cd "$path/Charts/"
/Users/paulmusgrave/Dropbox/0001 Academic Projects/Ongoing/0148 The Cyber/Posted/FPA Ver
> sion/Work/Charts

. 
. * custom labels for figures
. mylabels 0(10)80, myscale(@/100) local(myla)
0 "0" .1 "10" .2 "20" .3 "30" .4 "40" .5 "50" .6 "60" .7 "70" .8 "80"

. 
. * Overall
. quietly mlogit timetoattack i.cueAgree##i.cueIndependent threatiran ///
>         dem7 ind7 age female college white, baseoutcome(2)

. 
.         
. margins cueAgree, predict(outcome(1))

Predictive margins                              Number of obs     =        686
Model VCE    : OIM

Expression   : Pr(timetoattack==Would_support), predict(outcome(1))

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    cueAgree |
    Divided  |   .2323887   .0199133    11.67   0.000     .1933594    .2714181
    Support  |    .280419   .0219055    12.80   0.000     .2374851    .3233529
------------------------------------------------------------------------------

. marginsplot, name(supportAll) title("Overall, Support") ///
>         ytitle("") xtitle("") ylab(`myla') ///
>         ysize(3) xsize(2) 

  Variables that uniquely identify margins: cueAgree

.         margins cueAgree, predict(outcome(2))

Predictive margins                              Number of obs     =        686
Model VCE    : OIM

Expression   : Pr(timetoattack==Would_not_support), predict(outcome(2))

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    cueAgree |
    Divided  |   .4614134   .0248735    18.55   0.000     .4126623    .5101645
    Support  |   .3754943   .0237512    15.81   0.000     .3289428    .4220457
------------------------------------------------------------------------------

.         
. marginsplot, name(opposeAll) title("Overall, Oppose") ///
>         ytitle("") xtitle("") ylab(`myla') ///
>         ysize(3) xsize(2) 

  Variables that uniquely identify margins: cueAgree

.         
. margins cueAgree, predict(outcome(3))

Predictive margins                              Number of obs     =        686
Model VCE    : OIM

Expression   : Pr(timetoattack==Don_t_know), predict(outcome(3))

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    cueAgree |
    Divided  |   .3061978   .0248689    12.31   0.000     .2574557      .35494
    Support  |   .3440867   .0254725    13.51   0.000     .2941615    .3940119
------------------------------------------------------------------------------

. marginsplot, name(dontknowAll) ///
>         title("Overall, Don't Know") ///
>         ytitle("") xtitle("") ylab(`myla') ///
>         ysize(3) xsize(2) 

  Variables that uniquely identify margins: cueAgree

. 
. * Democrats
. quietly mlogit timetoattack i.cueAgree##i.cueIndependent threatiran ///
>         age female college white if dem7 == 1, baseoutcome(2)

.         
. margins cueAgree, atmeans predict(outcome(1))

Adjusted predictions                            Number of obs     =        326
Model VCE    : OIM

Expression   : Pr(timetoattack==Would_support), predict(outcome(1))
at           : 0.cueAgree      =    .4631902 (mean)
               1.cueAgree      =    .5368098 (mean)
               0.cueIndep~t    =    .5368098 (mean)
               1.cueIndep~t    =    .4631902 (mean)
               threatiran      =   -7.996421 (mean)
               age             =    47.26687 (mean)
               female          =    .5920245 (mean)
               college         =    .5153374 (mean)
               white           =    .7269939 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    cueAgree |
    Divided  |   .0592024   .0190259     3.11   0.002     .0219123    .0964925
    Support  |   .0709266   .0209138     3.39   0.001     .0299362    .1119169
------------------------------------------------------------------------------

. marginsplot, name(supportDem) title("Democrats, Support") ///
>         ytitle("") xtitle("") ylab(`myla') ///
>         ysize(3) xsize(2) 

  Variables that uniquely identify margins: cueAgree

.         
. margins cueAgree, atmeans predict(outcome(2))

Adjusted predictions                            Number of obs     =        326
Model VCE    : OIM

Expression   : Pr(timetoattack==Would_not_support), predict(outcome(2))
at           : 0.cueAgree      =    .4631902 (mean)
               1.cueAgree      =    .5368098 (mean)
               0.cueIndep~t    =    .5368098 (mean)
               1.cueIndep~t    =    .4631902 (mean)
               threatiran      =   -7.996421 (mean)
               age             =    47.26687 (mean)
               female          =    .5920245 (mean)
               college         =    .5153374 (mean)
               white           =    .7269939 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    cueAgree |
    Divided  |   .7041721   .0385895    18.25   0.000      .628538    .7798062
    Support  |   .5349444   .0397608    13.45   0.000     .4570147    .6128742
------------------------------------------------------------------------------

. marginsplot, name(opposeDem) title("Democrats, Oppose") ///
>         ytitle("") xtitle("") ylab(`myla') ///
>         ysize(3) xsize(2) 

  Variables that uniquely identify margins: cueAgree

.         
. margins cueAgree, atmeans predict(outcome(3))

Adjusted predictions                            Number of obs     =        326
Model VCE    : OIM

Expression   : Pr(timetoattack==Don_t_know), predict(outcome(3))
at           : 0.cueAgree      =    .4631902 (mean)
               1.cueAgree      =    .5368098 (mean)
               0.cueIndep~t    =    .5368098 (mean)
               1.cueIndep~t    =    .4631902 (mean)
               threatiran      =   -7.996421 (mean)
               age             =    47.26687 (mean)
               female          =    .5920245 (mean)
               college         =    .5153374 (mean)
               white           =    .7269939 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    cueAgree |
    Divided  |   .2366254   .0358209     6.61   0.000     .1664177    .3068332
    Support  |    .394129   .0385914    10.21   0.000     .3184913    .4697667
------------------------------------------------------------------------------

. marginsplot, name(dontknowDem) title("Democrats, Don't Know") ///
>         ytitle("") xtitle("") ylab(`myla') ///
>         ysize(3) xsize(2) 

  Variables that uniquely identify margins: cueAgree

. 
. * Independents
. quietly mlogit timetoattack i.cueAgree##i.cueIndependent threatiran ///
>         age female college white if ind7 == 1, baseoutcome(2)

.         
. margins cueAgree, atmeans predict(outcome(1)) 

Adjusted predictions                            Number of obs     =         98
Model VCE    : OIM

Expression   : Pr(timetoattack==Would_support), predict(outcome(1))
at           : 0.cueAgree      =    .4693878 (mean)
               1.cueAgree      =    .5306122 (mean)
               0.cueIndep~t    =    .6326531 (mean)
               1.cueIndep~t    =    .3673469 (mean)
               threatiran      =          -3 (mean)
               age             =     46.9898 (mean)
               female          =    .4795918 (mean)
               college         =    .2755102 (mean)
               white           =    .6938776 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    cueAgree |
    Divided  |   .0908559   .0429801     2.11   0.035     .0066166    .1750953
    Support  |   .3246481   .0745474     4.35   0.000     .1785379    .4707582
------------------------------------------------------------------------------

. marginsplot, name(supportInd) title("Independents, Support") ///
>         ytitle("") xtitle("") ylab(`myla') ///
>         ysize(3) xsize(2) 

  Variables that uniquely identify margins: cueAgree

.         
. margins cueAgree, atmeans predict(outcome(2)) 

Adjusted predictions                            Number of obs     =         98
Model VCE    : OIM

Expression   : Pr(timetoattack==Would_not_support), predict(outcome(2))
at           : 0.cueAgree      =    .4693878 (mean)
               1.cueAgree      =    .5306122 (mean)
               0.cueIndep~t    =    .6326531 (mean)
               1.cueIndep~t    =    .3673469 (mean)
               threatiran      =          -3 (mean)
               age             =     46.9898 (mean)
               female          =    .4795918 (mean)
               college         =    .2755102 (mean)
               white           =    .6938776 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    cueAgree |
    Divided  |   .4428173   .0794581     5.57   0.000     .2870822    .5985524
    Support  |   .3404422   .0736978     4.62   0.000     .1959971    .4848872
------------------------------------------------------------------------------

. marginsplot, name(opposeInd) title("Independents, Oppose") ///
>         ytitle("") xtitle("") ylab(`myla') ///
>         ysize(3) xsize(2) 

  Variables that uniquely identify margins: cueAgree

.         
. margins cueAgree, atmeans predict(outcome(3))

Adjusted predictions                            Number of obs     =         98
Model VCE    : OIM

Expression   : Pr(timetoattack==Don_t_know), predict(outcome(3))
at           : 0.cueAgree      =    .4693878 (mean)
               1.cueAgree      =    .5306122 (mean)
               0.cueIndep~t    =    .6326531 (mean)
               1.cueIndep~t    =    .3673469 (mean)
               threatiran      =          -3 (mean)
               age             =     46.9898 (mean)
               female          =    .4795918 (mean)
               college         =    .2755102 (mean)
               white           =    .6938776 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    cueAgree |
    Divided  |   .4663268   .0801266     5.82   0.000     .3092815     .623372
    Support  |   .3349098    .073383     4.56   0.000     .1910817    .4787378
------------------------------------------------------------------------------

. marginsplot, name(dontknowInd) title("Independents, Don't Know") ///
>         ytitle("") xtitle("") ylab(`myla') ///
>         ysize(3) xsize(2) 

  Variables that uniquely identify margins: cueAgree

. 
. * Republicans
. quietly mlogit timetoattack i.cueAgree##i.cueIndependent threatiran ///
>         age female college white if gop7 == 1, baseoutcome(2)

.         
. margins cueAgree, atmeans predict(outcome(1))

Adjusted predictions                            Number of obs     =        262
Model VCE    : OIM

Expression   : Pr(timetoattack==Would_support), predict(outcome(1))
at           : 0.cueAgree      =    .5496183 (mean)
               1.cueAgree      =    .4503817 (mean)
               0.cueIndep~t    =    .5038168 (mean)
               1.cueIndep~t    =    .4961832 (mean)
               threatiran      =    .8078881 (mean)
               age             =    55.43511 (mean)
               female          =     .480916 (mean)
               college         =    .4007634 (mean)
               white           =    .8854962 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    cueAgree |
    Divided  |   .4564259   .0442423    10.32   0.000     .3697125    .5431392
    Support  |   .4829393   .0493535     9.79   0.000     .3862082    .5796703
------------------------------------------------------------------------------

. marginsplot, name(supportGOP) title("Republicans, Support") ///
>         ytitle("") xtitle("") ylab(`myla') ///
>         ysize(3) xsize(2) 

  Variables that uniquely identify margins: cueAgree

.         
. margins cueAgree, atmeans predict(outcome(2))

Adjusted predictions                            Number of obs     =        262
Model VCE    : OIM

Expression   : Pr(timetoattack==Would_not_support), predict(outcome(2))
at           : 0.cueAgree      =    .5496183 (mean)
               1.cueAgree      =    .4503817 (mean)
               0.cueIndep~t    =    .5038168 (mean)
               1.cueIndep~t    =    .4961832 (mean)
               threatiran      =    .8078881 (mean)
               age             =    55.43511 (mean)
               female          =     .480916 (mean)
               college         =    .4007634 (mean)
               white           =    .8854962 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    cueAgree |
    Divided  |   .2055461   .0355381     5.78   0.000     .1358927    .2751994
    Support  |   .2053363   .0392794     5.23   0.000     .1283501    .2823225
------------------------------------------------------------------------------

. marginsplot, name(opposeGOP) title("Republicans, Oppose") ///
>         ytitle("") xtitle("") ylab(`myla') ///
>         ysize(3) xsize(2) 

  Variables that uniquely identify margins: cueAgree

.         
. margins cueAgree, atmeans predict(outcome(3))

Adjusted predictions                            Number of obs     =        262
Model VCE    : OIM

Expression   : Pr(timetoattack==Don_t_know), predict(outcome(3))
at           : 0.cueAgree      =    .5496183 (mean)
               1.cueAgree      =    .4503817 (mean)
               0.cueIndep~t    =    .5038168 (mean)
               1.cueIndep~t    =    .4961832 (mean)
               threatiran      =    .8078881 (mean)
               age             =    55.43511 (mean)
               female          =     .480916 (mean)
               college         =    .4007634 (mean)
               white           =    .8854962 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    cueAgree |
    Divided  |    .338028     .04178     8.09   0.000     .2561407    .4199154
    Support  |   .3117244   .0453445     6.87   0.000     .2228508     .400598
------------------------------------------------------------------------------

. marginsplot, name(dontknowGOP) title("Republicans, Don't Know") ///
>         ytitle("") xtitle("") ylab(`myla') ///
>         ysize(3) xsize(2) 

  Variables that uniquely identify margins: cueAgree

. 
. * Pulling together the plots
. graph combine supportAll opposeAll dontknowAll supportDem opposeDem dontknowDem ///
>         supportInd opposeInd dontknowInd supportGOP opposeGOP dontknowGOP, ///
>         title("Figure 3: Predicted Support for Retaliation""by Party and Outcome Varia
> ble") ///
>         subtitle("2018 CCES Experiment; Multinomial logistic regression",size(small)) 
> ///
>         rows(4) xsize(6) ysize(10) ycommon xcommon

. 
. graph export "Figure 3.pdf", replace
(file /Users/paulmusgrave/Dropbox/0001 Academic Projects/Ongoing/0148 The Cyber/Posted/F
> PA Version/Work/Charts/Figure 3.pdf written in PDF format)

. 
. 
. *********************
. * Generating Tables
. *********************
. 
. * Reworking labels
. lab def cueAgreelab2 0 "Divided Endorsement" 1 "Supportive Endorsement"

. lab val cueAgree cueAgreelab2

. 
. lab def cueCIAlab 0 "Independent Experts" 1 "CIA Endorsement"

. lab val cueCIA cueCIAlab

. 
. * new mlogits
. * Overall
. quietly mlogit timetoattack i.cueAgree##i.cueIndependent  threatiran ///
>         dem7 ind7 age female college white, baseoutcome(2)

. eststo mlog1

. 
. * democrats
. quietly mlogit timetoattack i.cueAgree##i.cueIndependent   threatiran ///
>         age female college white if dem7==1, baseoutcome(2)

. eststo mlog2

. 
. * independents
. quietly mlogit timetoattack i.cueAgree##i.cueIndependent   threatiran ///
>         age female college white if ind7==1, baseoutcome(2)

. eststo mlog3

. 
. * republicans
. quietly mlogit timetoattack i.cueAgree##i.cueIndependent   threatiran ///
>         age female college white if gop7==1, baseoutcome(2)

. eststo mlog4

. 
. cd "$path/Tables/"
/Users/paulmusgrave/Dropbox/0001 Academic Projects/Ongoing/0148 The Cyber/Posted/FPA Ver
> sion/Work/Tables

. 
.  
. esttab mlog1 mlog2 mlog3 mlog4 ///
>         using "CCESExperimentMLogitTablePID7.tex", ///
>         label mtitles("Full" "Democrats" "Independents" "Republicans") ///
>         interaction(x) nobaselevels noomitted longtable ///
>         title("Multinomial Logit Regression of Support for Retaliatory Counter Cyber-S
> trikes") replace
(output written to CCESExperimentMLogitTablePID7.tex)

.  
.  
. * full mlogit coefficient plot
. cd "$path/Charts/"
/Users/paulmusgrave/Dropbox/0001 Academic Projects/Ongoing/0148 The Cyber/Posted/FPA Ver
> sion/Work/Charts

. 
. coefplot (mlog1, label(All Respondents)) ///
>         (mlog2, label(Democrats) offset(.3)) ///
>         (mlog3, label(Independents) offset(.15)) ///
>         (mlog4, label(Republicans) offset(-.15)), ///
>         drop(_cons dem7 ind7 age threatiran) xline(0) ///
>         title("Predictors of Support") ///
>         subtitle("Multinomial Coefficients") ///
>         nobaselevels

.  
.  graph export "CCESExperimentMlogitByParty.pdf", replace
(file /Users/paulmusgrave/Dropbox/0001 Academic Projects/Ongoing/0148 The Cyber/Posted/F
> PA Version/Work/Charts/CCESExperimentMlogitByParty.pdf written in PDF format)

. 
.  log close
      name:  <unnamed>
       log:  /Users/paulmusgrave/Dropbox/0001 Academic Projects/Ongoing/0148 The Cyber/P
> osted/FPA Version/Work/Logs/Figure3Log.log
  log type:  text
 closed on:  25 Aug 2021, 10:37:54
----------------------------------------------------------------------------------------
